package qx.hyj.demos.V0;

import lombok.Data;
import net.bytebuddy.implementation.bytecode.Throw;
import qx.hyj.demos.enums.ErrorCode;

@Data
public class JsonResult<T> {
    private String code;
    private String msg;
    private Boolean success;
    private T data;

    public JsonResult(T data) {
        this.setCode("200");
        this.setMsg("success");
        this.setSuccess(true);
        this.setData(data);
    }

    public JsonResult(T data, ErrorCode errorCode) {
        this.setCode(errorCode.getCode());
        this.setMsg(errorCode.getMessage());
        this.setSuccess(false);
        this.setData(data);

    }
}
